<style>
  .green{
		background-color: #ff6600 !important;
		color: #fff;
	}
</style>
<template>
  <div class="m-25 mt-65">
    <div class="normal-box-mod">
      <div class="normal-box-hd clearfix">
        <div class="normal-box-title">
          <div class="decorate-square"></div>
          <h2>机器管理</h2>
        </div>
      </div>

      <Card style="margin-bottom: 10px;">
        <div class="normal-list-page-hd clearfix">
          <Form v-model="queryData">
            <Row>
              <Col span="5" class="mr-10">
              <queryData  @ProvinceData="childByValue" style="width:100%"></queryData>
              </Col>
              机器编号:
               <Input class="mr-10" placeholder="请输入机器编号" v-model="queryData.code" style="width: 150px" />
				      社区名称:
                <Input class="mr-10" placeholder="请输入地址" v-model="queryData.name" style="width: 150px" />
              机器类型:
                <Select class="mr-10" v-model="queryData.sbType" style="width:150px" :clearable=true>
                  <Option v-for="item in newSbType.sbType" :value="item.value" :key="item.value">{{ item.label }}</Option>
                </Select>

              <Button type="primary" custom-icon="iconfont icon-chaxun" size="small" @click='inQuire'>查询</Button>

            </Row>
          </Form>
        </div>
      </Card>
      <div class="normal-list-page-hd clearfix">
        <Button type="primary" custom-icon="iconfont icon-fangkuai2" size="small" @click="showCreateModal" class="fr">新建</Button>
      </div>
      <div class="normal-list-page-bd">
        <Table border :loading="list.loading" :columns="list.columns" :data="list.tableData"></Table>
      </div>
      <div>
        <Page :total="queryData.totalRecord" :page-size="queryData.pageSize" :current="queryData.page"  show-total show-elevator @on-change="changePage"></Page>
      </div>

      <Modal v-model="modal.lntegralSet.thatShow" :loading="modal.lntegralSet.loading" :mask-closable="false" :title="modal.lntegralSet.title"
        @on-ok="postData" @on width='800'>
        <Form :model="modal.lntegralSet.formData" :label-width="150" ref="newUpData" :rules="modal.lntegralSet.rules">
          <Row>
            <Col span="12">
            <FormItem label="机器编号" prop="code" v-model="modal.lntegralSet.formData.code">
              <Input v-model="modal.lntegralSet.formData.code" style="width:150px" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="机器名称" prop="factoryname" v-model="modal.lntegralSet.formData.factoryname">
              <Input v-model="modal.lntegralSet.formData.factoryname" style="width:150px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="设备手机号" prop="mobilephone" v-model="modal.lntegralSet.formData.mobilephone">
              <Input v-model="modal.lntegralSet.formData.mobilephone" style="width:150px" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="设备备用号" prop="telephone" v-model="modal.lntegralSet.formData.telephone">
              <Input v-model="modal.lntegralSet.formData.telephone" style="width:150px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="安装时间" prop="installtime" v-model="modal.lntegralSet.formData.installtime">
              <Input v-model="modal.lntegralSet.formData.installtime" style="width:150px" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="通信卡号" prop="simCardno" v-model="modal.lntegralSet.formData.simCardno">
              <Input placeholder="请输入次数" v-model="modal.lntegralSet.formData.simCardno" style="width:150px;" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="短信提示名称" prop="linkname" v-model="modal.lntegralSet.formData.linkname">
              <Input v-model="modal.lntegralSet.formData.linkname" style="width:150px" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="保洁员电话" prop="linkmophone" v-model="modal.lntegralSet.formData.linkmophone">
              <Input placeholder="多个电话用英文逗号隔开" v-model="modal.lntegralSet.formData.linkmophone" style="width:150px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="信息进制" prop="linkname" v-model="modal.lntegralSet.formData.state">
              <Select v-model="modal.lntegralSet.formData.state" size="small" style="width:100px">
                <Option v-for="item in newSbType.radiomessage" :value="item.value" :key="item.value">{{ item.label }}</Option>
              </Select>
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="垃圾袋剩余数" prop="surplusnum" v-model="modal.lntegralSet.formData.surplusnum">
              <Input v-model="modal.lntegralSet.formData.surplusnum" style="width:150px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="机器类型" prop="sbType">
              <Select v-model="modal.lntegralSet.formData.sbType" size="small" style="width:100px">
                <Option v-for="item in newSbType.sbType" :value="item.value" :key="item.value">{{ item.label }}</Option>
              </Select>
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="通信网格格式" prop="wangluo" v-model="modal.lntegralSet.formData.wangluo">
              <Input v-model="modal.lntegralSet.formData.wangluo" style="width:150px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="是否计重" prop="weightFlag" v-model="modal.lntegralSet.formData.weightFlag">
              <Select v-model="modal.lntegralSet.formData.weightFlag" size="small" style="width:100px">
                <Option v-for="item in newSbType.weightFlag" :value="item.value" :key="item.value">{{ item.label }}</Option>
              </Select>
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="兑换方式" prop="redpacketFlag">
              <Select size="small" style="width:100px" v-model="modal.lntegralSet.formData.redpacketFlag">
                <Option v-for="item in newSbType.redpacketFlag" :value="item.value" :key="item.value">{{ item.label }}</Option>
              </Select>
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="主板类型" prop="zhuban" v-model="modal.lntegralSet.formData.zhuban">
              <Input v-model="modal.lntegralSet.formData.zhuban" style="width:150px" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="钥匙编号" prop="yaoshi" v-model="modal.lntegralSet.formData.yaoshi">
              <Input v-model="modal.lntegralSet.formData.yaoshi" style="width:150px" />
            </FormItem>
            </Col>
          </Row>

          <Row>
            <Col span="12">
            <FormItem label="软件版本号" prop="mVersion" v-model="modal.lntegralSet.formData.mVersion">
              <Input placeholder="请输入个数" v-model="modal.lntegralSet.formData.mVersion" style="width:150px;" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="设备编号" prop="mEpc" v-model="modal.lntegralSet.formData.mEpc">
              <Input placeholder="请输入次数" v-model="modal.lntegralSet.formData.mEpc" style="width:150px;" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="安装地址" prop="address" v-model="modal.lntegralSet.formData.address">
              <Input v-model="modal.lntegralSet.formData.address" style="width:535px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="软件路径" prop="softPath" v-model="modal.lntegralSet.formData.softPath">
              <Input placeholder="请输入次数" v-model="modal.lntegralSet.formData.softPath" style="width:535px;" />
            </FormItem>
            </Col>
          </Row>

          <FormItem label="设备所在区域" prop="softPath">
            <Row>
              <Col>
              <queryData @ProvinceData="formdataValue" style="width: 535px"></queryData>
              </Col>
            </Row>
          </FormItem>
        </Form>
      </Modal>

      <Modal v-model="modal.lntegralSet.thisShow" :loading="modal.lntegralSet.loading" :mask-closable="false" :title="modal.lntegralSet.title"
        @on-ok="getData" width='800'>
        <Form :model="modal.lntegralSet.formData" :label-width="150" ref="newgetData" :rules="modal.lntegralSet.rules">
          <Row>
            <Col span="12">
            <FormItem label="机器编号" prop="code" v-model="modal.lntegralSet.formData.code">
              <Input v-model="modal.lntegralSet.formData.code" style="width:150px" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="机器名称" prop="factoryname" v-model="modal.lntegralSet.formData.factoryname">
              <Input v-model="modal.lntegralSet.formData.factoryname" style="width:150px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="设备手机号" prop="mobilephone" v-model="modal.lntegralSet.formData.mobilephone">
              <Input v-model="modal.lntegralSet.formData.mobilephone" style="width:150px" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="设备备用号" prop="telephone" v-model="modal.lntegralSet.formData.telephone">
              <Input v-model="modal.lntegralSet.formData.telephone" style="width:150px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="安装时间" prop="installtime" v-model="modal.lntegralSet.formData.installtime">
              <Input v-model="modal.lntegralSet.formData.installtime" style="width:150px" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="通信卡号" prop="simCardno" v-model="modal.lntegralSet.formData.simCardno">
              <Input placeholder="请输入次数" v-model="modal.lntegralSet.formData.simCardno" style="width:150px;" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="短信提示名称" prop="linkname" v-model="modal.lntegralSet.formData.linkname">
              <Input v-model="modal.lntegralSet.formData.linkname" style="width:150px" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="保洁员电话" prop="linkmophone" v-model="modal.lntegralSet.formData.linkmophone">
              <Input placeholder="多个电话用英文逗号隔开" v-model="modal.lntegralSet.formData.linkmophone" style="width:150px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="信息进制" prop="state" v-model="modal.lntegralSet.formData.state">
              <Select v-model="modal.lntegralSet.formData.state" size="small" style="width:100px">
                <Option v-for="item in newSbType.radiomessage" :value="item.value" :key="item.value">{{ item.label }}</Option>
              </Select>
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="垃圾袋剩余数" prop="surplusnum" v-model="modal.lntegralSet.formData.surplusnum">
              <Input v-model="modal.lntegralSet.formData.surplusnum" style="width:150px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="机器类型" prop="sbType">
              <Select v-model="modal.lntegralSet.formData.sbType" size="small" style="width:100px">
                <Option v-for="item in newSbType.sbType" :value="item.value" :key="item.value">{{ item.label }}</Option>
              </Select>
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="通信网格格式" prop="wangluo" v-model="modal.lntegralSet.formData.wangluo">
              <Input v-model="modal.lntegralSet.formData.wangluo" style="width:150px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="是否计重" prop="weightFlag" v-model="modal.lntegralSet.formData.weightFlag">
              <Select v-model="modal.lntegralSet.formData.weightFlag" size="small" style="width:100px">
                <Option v-for="item in newSbType.weightFlag" :value="item.value" :key="item.value">{{ item.label }}</Option>
              </Select>
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="兑换方式" prop="redpacketFlag">
              <Select size="small" style="width:100px" v-model="modal.lntegralSet.formData.redpacketFlag">
                <Option v-for="item in newSbType.redpacketFlag" :value="item.value" :key="item.value">{{ item.label }}</Option>
              </Select>
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="12">
            <FormItem label="主板类型" prop="zhuban" v-model="modal.lntegralSet.formData.zhuban">
              <Input v-model="modal.lntegralSet.formData.zhuban" style="width:150px" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="钥匙编号" prop="yaoshi" v-model="modal.lntegralSet.formData.yaoshi">
              <Input v-model="modal.lntegralSet.formData.yaoshi" style="width:150px" />
            </FormItem>
            </Col>
          </Row>

          <Row>
            <Col span="12">
            <FormItem label="软件版本号" prop="mVersion" v-model="modal.lntegralSet.formData.mVersion">
              <Input placeholder="请输入个数" v-model="modal.lntegralSet.formData.mVersion" style="width:150px;" />
            </FormItem>
            </Col>
            <Col span="12">
            <FormItem label="设备编号" prop="mEpc" v-model="modal.lntegralSet.formData.mEpc">
              <Input placeholder="请输入次数" v-model="modal.lntegralSet.formData.mEpc" style="width:150px;" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="24">
            <FormItem label="安装地址" prop="address" v-model="modal.lntegralSet.formData.address">
              <Input v-model="modal.lntegralSet.formData.address" style="width:535px" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col span="24">
            <FormItem label="软件路径" prop="softPath" v-model="modal.lntegralSet.formData.softPath">
              <Input placeholder="请输入次数" v-model="modal.lntegralSet.formData.softPath" style="width:535px;" />
            </FormItem>
            </Col>
          </Row>
          <Row>
            <Col>
            <FormItem label="设备所在区域" prop="softPath">
              <queryData @ProvinceData="formdataValue" style="width: 535px"></queryData>
            </FormItem>
            </Col>
          </Row>
        </Form>
      </Modal>
      <Modal v-model="modal.lntegralSet.upShow" :loading="modal.lntegralSet.loading" :mask-closable="false" :title="modal.lntegralSet.title"
        @on-ok="newToUpData" width="600">
        <Form ref="toUpdata" :model="modal.lntegralSet.formData" :rules="modal.lntegralSet.rules" :label-width="200">
          <FormItem label="当前机器软件版本文件">
            <span>{{newSbType.oldUpdata.softPath}}</span>
          </FormItem>
          <FormItem label="可选软件版本文件" v-model="modal.lntegralSet.formUpData.softPath">
            <Select v-model="modal.lntegralSet.formData.path" size="small" style="width:260px">
              <Option v-for="item in newSbType.form" :value="item.path" :key="item.path">{{ item.path }}</Option>
            </Select>
          </FormItem>
        </Form>
      </Modal>
    </div>
  </div>
</template>
<script>
import gcDustbinApi from '@/api/ckMachineCenter/MCmanagement.js'
import moment from 'moment'
import {
  Message
} from 'iview'
import queryData from '@/view/test/city.vue'

export default {
  name: 'lntegralSet',
  components: {
    queryData
  },
  data () {
    return {
      value: true,
      indeterminate: false,
      checkAll: false,
      newSbType: {
        queryForm: {

        },
        oldUpdata: [],
        cityCascade: {
          please: '',
          provid: [],
          cityid: [],
          distid: [],
          strt: [],
          commid: [],
          comminid: []
        },
        form: [],
        valueProvid: [],
        formMessage: [

        ],
        radiomessage: [{
          value: '1',
          label: '10进制'
        },
        {
          value: '2',
          label: '16进制'
        }
        ],
        provid: [

        ],
        sbType: [{
          value: '1',
          label: '发放机'
        },
        {
          value: '2',
          label: '分类箱'
        },
        {
          value: '3',
          label: '回收箱'
        },
        {
          value: '4',
          label: '测试/弃用'
        }
        ],
        weightFlag: [{
          value: '0',
          label: '无需计重'
        },
        {
          value: '1',
          label: '计重'
        }
        ],
        redpacketFlag: [{
          value: '0',
          label: '村口积分'
        },
        {
          value: '1',
          label: '现金红包'
        }
        ]
      },
      // 弹出层数据
      modal: {
        lntegralSet: {
          thisShow: false,
          thatShow: false,
          upShow: false,
          loading: true,
          type: 'create', // create 新建，update 修改
          title: '新建',
          rules: {

            code: [{
              required: true,
              message: '机器编号长度必须为13位',
              trigger: 'blur'
            }],
            factoryname: [{
              required: true,
              message: '机器名称不能为空',
              trigger: 'blur'
            }],
            address: [{
              required: true,
              message: '安装地址不能为空',
              trigger: 'blur'
            }],
            //  installtime:[
            //   {
            // 	  required:true,
            // 	  message:"请填写安装时间",
            // 	  trigger:"blur"
            //   }
            //
            //   ],
            linkname: [{
              required: true,
              message: '短信提示',
              trigger: 'blur'
            }

            ],
            // linkmophone:[
            // 	{
            // 		required:true,
            // 		message:"请填写保洁员电话",
            // 		trigger:"blur"
            // 	}
            // ],
            cityid: [{
              required: true,
              message: '请选择',
              trigger: 'blur',
              type: 'number'
            }],
            distid: [{
              required: true,
              message: '请选择',
              trigger: 'blur',
              type: 'number'
            }],
            strtid: [{
              required: true,
              message: '请选择',
              trigger: 'blur',
              type: 'number'
            }],
            strt: [{
              required: true,
              message: '请选择',
              trigger: 'blur',
              type: 'number'
            }],
            commid: [{
              required: true,
              message: '请选择',
              trigger: 'blur',
              type: 'number'
            }],
            // comminid:[
            // 	{
            // 		required:true,
            // 		message:"请选择",
            // 		trigger:"blur",
            // 		type:'number'
            // 	}
            // ],
            // wangluo:[
            // 	{
            // 		required:true,
            // 		message:"请填写",
            // 		trigger:"blur"
            // 	}
            // ],
            state: [{
              required: true,
              message: '请选择',
              trigger: 'blur'
            }],
            weightFlag: [{
              required: true,
              message: '请选择',
              trigger: 'blur'
            }],
            sbType: [{
              required: true,
              message: '请选择机器类型',
              trigger: 'blur'
            }],
            redpacketFlag: [{
              required: true,
              message: '请选择兑换方式',
              trigger: 'blur'
            }],
            // zhuban:[
            // 	{
            // 		required:true,
            // 		message:"请选择主板类型",
            // 		trigger:"blur"
            // 	}
            // ],
            // yaoshi:[
            // 	{
            // 		required:true,
            // 		message:"请填写钥匙",
            // 		trigger:"blur"
            // 	}
            // ],
            provid: [{
              required: true,
              message: '请选择地区',
              trigger: 'blur',
              type: 'number'
            }]
            // mVersion:[
            // 	{
            // 		required:true,
            // 		message:"请填写软件版本号",
            // 		trigger:"blur"
            // 	}
            // ],
            // mEpc:[
            // 	{
            // 		required:true,
            // 		message:"请填写设备编号",
            // 		trigger:"blur"
            // 	}
            // ],
            // simCardno:[
            // 	{
            // 		required:true,
            // 		message:"请填写通信卡号",
            // 		trigger:"blur"
            // 	}
            // ],
            // softPath:[
            // 	{
            // 		required:true,
            // 		message:"请填写软件路径",
            // 		trigger:"blur"
            // 	}
            // ],
          },
          formUpData: {
            code: '',
            sbType: ''
            // softPath:''
          },
          formData: {
            cityid: '',
            code: '',
            provid: '',

            distid: '',
            strt: '',
            commid: '',
            comminid: ''
            // name: "",
            // url: "",
            // state: ""
          }
        }
      },
      // 列表
      list: {
        loading: false,
        selections: [],
        // 列表展示数据
        tableData: [],
        // 表格表头
        columns: [
          // 开始自动生成
          {
            title: '机器编号',
            key: 'code',
            fixed: 'left',
            align: 'center',
            minWidth: 160
          },
          {
            title: '社区名称',
            key: 'name',
            align: 'center',
            minWidth: 100
          },
          {
            title: '安装时间',
            key: 'installtime',
            align: 'center',
            minWidth: 120
          },
          {
            title: '机器类型',
            key: 'sbType',
            align: 'center',
            minWidth: 120,

            render: (h, params) => {
              if (params.row.sbType == '1') {
                return h('div', '发放机')
              } else if (params.row.sbType == '2') {
                return h('div', '分类箱')
              } else if (params.row.sbType == '3') {
                return h('div', {
                  style: {
                    color: 'red'
                  }
                }, '回收箱')
              } else if (params.row.sbType == '4') {
                return h('div', '测试/弃用')
              }
            }
          },
          {
            title: '机器名称',
            align: 'center',
            key: 'linkname',
            minWidth: 200
          },
          {
            title: '售后电话',
            key: 'linkmophone',
            align: 'center',
            minWidth: 150
          }, {
            title: '机器进制',
            key: 'state',
            minWidth: 120,
            render: (h, params) => {
              if (params.row.state == '1') {
                return h('div', '10进制')
              } else if (params.row.state == '2') {
                return h('div', '16进制')
              }
            }
          },
          {
            title: '是否称重',
            key: 'weightFlag',
            align: 'center',
            minWidth: 120,
            render: (h, params) => {
              if (params.row.weightFlag == '1') {
                return h('div', '计重')
              } else if (params.row.weightFlag == '0') {
                return h('div', '无需计重')
              }
            }
          },
          {
            title: '兑换方式',
            key: 'redpacketFlag',
            align: 'center',
            minWidth: 120,
            render: (h, params) => {
              if (params.row.redpacketFlag == '1') {
                return h('div', '现金红包')
              } else if (params.row.redpacketFlag == '0') {
                return h('div', '村口积分')
              }
            }
          },
          {
            title: '软件版本号',
            key: 'mVersion',
            align: 'center',
            minWidth: 150
          },
          {
            title: '通讯模式',
            key: 'wangluo',
            align: 'center',
            minWidth: 150
          },
          {
            title: '通讯电话卡',
            key: 'simCardno',
            align: 'center',
            minWidth: 150
          },
          {
            title: '主板信息',
            key: 'zhuban',
            align: 'center',
            minWidth: 200
          },
          {
            title: '设备电子编号',
            key: 'mEpc',
            align: 'center',
            minWidth: 150
          },
          {
            title: '钥匙编号',
            key: 'yaoshi',
            align: 'center',
            minWidth: 120
          },
          {
            title: '添加人',
            key: 'insertName',
            align: 'center',
            minWidth: 100
          },
          {
            title: '操作',
            align: 'center',
            fixed: 'right',
            minWidth: 320,
            render: (h, params) => {
              return h('div', [
                h(
                  'Tooltip',
                  {
                    props: {
                      placement: 'left',
                      content: '编辑'
                    },
                    style: {
                      cursor: 'pointer'
                    }
                  },
                  [
                    h(
                      'Button',
                      {
                        props: {
                          type: 'primary',
                          size: 'small'
                        },
                        style: {
                          marginRight: '5px',
                          padding: '1px 2px'
                        },
                        on: {
                          click: () => {
                            this.showUpdateModal(params.row)
                          }
                        }
                      },
                      [
                        h('Icon', {
                          props: {
                            type: ' iconfont icon-bianjisekuai',
                            size: 18
                          }
                        })
                      ]
                    )
                  ]
                ),
                h(
                  'Button', {
                    props: {
                      type: 'success',
                      size: 'small'

                    },
                    style: {
                      marginRight: '5px'
                    },
                    on: {
                      click: () => {
                        this.recover(params.row)
                      }
                    }
                  },
                  '一键恢复(CK717操作)'
                ),

                h(
                  'Tooltip',
                  {
                    props: {
                      placement: 'right',
                      content: '删除'
                    },
                    style: {
                      cursor: 'pointer'
                    }
                  },
                  [
                    h(
                      'Button',
                      {
                        props: {
                          type: 'error',
                          size: 'small'
                        },
                        style: {
                          marginRight: '5px',
                          padding: '1px 2px'
                        },
                        on: {
                          click: () => {
                            this.delData(params.row)
                          }
                        }
                      },
                      [
                        h('Icon', {
                          props: {
                            type: ' iconfont icon-shanchusekuai',
                            size: 18
                          }
                        })
                      ]
                    )
                  ]
                ),

                h(
                  'Tooltip',
                  {
                    props: {
                      placement: 'left',
                      content: '更新软件(CK717操作'
                    },
                    style: {
                      cursor: 'pointer'
                    }
                  },
                  [
                    h(
                      'Button',
                      {
                        props: {
                          type: 'primary',
                          size: 'small'
                        },
                        style: {
                          marginRight: '5px',
                          padding: '1px 2px'
                        },
                        on: {
                          click: () => {
                            this.toUpdata(params.row)
                          }
                        }
                      },
                      [
                        h('Icon', {
                          props: {
                            type: 'ios-sync',
                            size: 18
                          }
                        })
                      ]
                    )
                  ]
                )

              ])
            }
          }
        ]
      },
      // 页面查询数据
      queryData: {
        limit: 10,
        page: 1,
        totalRecord: 0

      }
    }
  },
  methods: {

    // 获取列表
    getTableData () {
      const that = this
      that.queryData.totalRecord = undefined
      gcDustbinApi.getPageList(that.queryData)
        .then(res => {
          // console.log(res.data);
          that.list.tableData = res.data.list
          for (var i = 0; i < res.data.list.length; i++) {
            if (res.data.list[i].sbType == '4') {
              that.list.tableData[i].cellClassName = {
                sbType: 'green'
              }
              // console.log(that.list.tableData)
            }
          }
          that.queryData.totalRecord = res.data.totalRecord
          that.queryData.limit = res.data.pageSize
        })
        .catch(error => {
          Message.error(error)
        })
    },

    // 修改
    postData () {
      const that = this
      that.$refs['newUpData'].validate(valid => {
        if (valid) {
          gcDustbinApi.update(that.modal.lntegralSet.formData)
            .then(res => {
              that.modal.lntegralSet.thatShow = false
              // that.modal.lntegralSet.loading = false;
              if (!res.code) {
                that.getTableData()
                that.$Notice.success({
                  title: '保存成功!'
                })
              } else {
                that.$Notice.error({
                  title: res.message
                })
              }
            })
            .catch(error => {
              Message.error(error)
            })
        } else {
          that.modal.lntegralSet.loading = false
          that.$nextTick(() => {
            that.modal.lntegralSet.loading = true
          })
        }
      })
    },
    // 删除
    delData (data) {
      this.$Modal.confirm({
        title: '确认删除',
        content: '<p>您确认删除 <strong>' +
            data.name.toString() + data.linkname.toString() +
            '</strong>的记录吗?</p><p>删除后将无法撤销，请谨慎操作！</p>',
        loading: true,
        onOk: () => {
          gcDustbinApi.del(data).then(res => {
            this.$Modal.remove()
            if (!res.code) {
              this.$Notice.success({
                title: '删除成功'
              })
              this.getTableData()
            } else {
              this.$Notice.error({
                title: res.message
              })
            }
          })
        }
      })
    },
    recover (data) {
      this.$Modal.confirm({
        title: '确认恢复',
        content: '<p>您确认恢复 <strong>' +
            data.name.toString() + data.linkname.toString() +
            '</strong>的记录吗?</p><p>删除后将无法撤销，请谨慎操作！</p>',
        loading: true,
        onOk: () => {
          gcDustbinApi.recover(data).then(res => {
            this.$Modal.remove()
            if (!res.code) {
              this.$Notice.success({
                title: '恢复成功'
              })
              this.getTableData()
            } else {
              this.$Notice.error({
                title: res.message
              })
            }
          })
        }
      })
    },
    toUpdata (data) {
      this.modal.lntegralSet.type = 'update'
      this.modal.lntegralSet.title = '更新'
      const that = this
      that.newSbType.oldUpdata = data
      gcDustbinApi.getUpdata(data).then(res => {
        let message = res.data[0]
        that.newSbType.form = res.data

        that.modal.lntegralSet.formData = message
        that.modal.lntegralSet.upShow = true
      })
        .catch(error => {
          Message.error(error)
        })
    },
    // 软件更新
    newToUpData () {
      const that = this
      let softPath = that.modal.lntegralSet.formData.path
      that.modal.lntegralSet.formUpData.code = that.newSbType.oldUpdata.code
      that.modal.lntegralSet.formUpData.sbType = that.newSbType.oldUpdata.sbType
      that.modal.lntegralSet.formUpData.softpath = softPath
      gcDustbinApi.newToUp(that.modal.lntegralSet.formUpData)
        .then(res => {
          that.modal.lntegralSet.upShow = false
          that.modal.lntegralSet.loading = false
          if (!res.code) {
            that.getTableData()
            that.$Notice.success({
              title: '保存成功!'
            })
          } else {
            that.$Notice.error({
              title: res.message
            })
          }
        })
        .catch(error => {
          Message.error(error)
        })
    },
    // 新建
    getData () {
      const that = this
      that.$refs['newgetData'].validate(valid => {
        if (valid) {
          gcDustbinApi.add(that.modal.lntegralSet.formData)
            .then(res => {
              that.modal.lntegralSet.thisShow = false
              // that.modal.lntegralSet.loading = false;
              if (!res.code) {
                that.getTableData()
                that.$Notice.success({
                  title: '保存成功!'
                })
              } else {
                that.$Notice.error({
                  title: res.message
                })
              }
            })
            .catch(error => {
              Message.error(error)
            })
        } else {
          that.modal.lntegralSet.loading = false
          that.$nextTick(() => {
            that.modal.lntegralSet.loading = true
          })
        }
      })
    },

    // 查询
    inQuire () {
      const that = this
      that.getTableData()
    },

    // 全选，不全选
    // selectionChange(args) {
    //   this.list.selections = args;
    // },

    // 每页显示记录数变更
    onPageSizeChange (pageSize) {
      this.queryData.limit = pageSize
      this.getTableData()
    },

    // 换页
    changePage (page) {
      this.queryData.page = page
      this.getTableData()
    },

    // 显示新建弹窗
    showCreateModal () {
      this.modal.lntegralSet.title = '新建'
      this.modal.lntegralSet.formData = {}
      this.modal.lntegralSet.thisShow = true
    },

    // 显示修改弹窗
    showUpdateModal (id) {
      this.modal.lntegralSet.type = 'update'
      this.modal.lntegralSet.title = '修改'
      const that = this
      gcDustbinApi.getDetail(id).then(res => {
        that.newSbType.formMessage = res.data
        that.modal.lntegralSet.formData = res.data
        that.modal.lntegralSet.thatShow = true
      })
        .catch(error => {
          Message.error(error)
        })
    },
    childByValue (newObject) {
      this.queryData.provid = newObject.provid
      this.queryData.commid = newObject.commid
      this.queryData.cityid = newObject.cityid
      this.queryData.comminid = newObject.comminid
      this.queryData.distid = newObject.distid
      this.queryData.strt = newObject.strt
    },
    formdataValue (formdata) {
      this.modal.lntegralSet.formData.provid = formdata.provid
      this.modal.lntegralSet.formData.commid = formdata.commid
      this.modal.lntegralSet.formData.cityid = formdata.cityid
      this.modal.lntegralSet.formData.comminid = formdata.comminid
      this.modal.lntegralSet.formData.distid = formdata.distid
      this.modal.lntegralSet.formData.strt = formdata.strt
    }

  },

  async created () {
    await setTimeout({},1000)
    let area = window.defArea
    this.queryData.provid = area[0]
    this.queryData.cityid = area[1]
    this.queryData.distid = area[2]
    this.getTableData()
  }
}
</script>
